package zy.ejb2;

import java.rmi.RemoteException;

import javax.ejb.EJBException;
import javax.ejb.SessionBean;
import javax.ejb.SessionContext;

public class HelloWorldBean implements SessionBean {
	private SessionContext context = null;
	/**
	  * 
	  */
	private static final long serialVersionUID = 1L;

	public void ejbCreate() {
		System.out.println("HelloBean: ejbCreate() is called!");
		System.out.println(new java.sql.Time(System.currentTimeMillis())
				+ "执行_ejbCreate()");
	}

	@Override
	public void ejbActivate() throws EJBException, RemoteException {
		// TODO Auto-generated method stub
		System.out.println(new java.sql.Time(System.currentTimeMillis())
				+ "执行_ejbActivate()");
	}

	@Override
	public void ejbPassivate() throws EJBException, RemoteException {
		// TODO Auto-generated method stub
		System.out.println(new java.sql.Time(System.currentTimeMillis())
				+ "执行_ejbPassivate()");
	}

	@Override
	public void ejbRemove() throws EJBException, RemoteException {
		System.out.println(new java.sql.Time(System.currentTimeMillis())
				+ "执行_ejbRemove()");

	}

	@Override
	public void setSessionContext(SessionContext arg0) throws EJBException,
			RemoteException {
		this.context = arg0;

	}

	public String sayHello_Remote() throws RemoteException {
		return "Welecome to ejb2.0, Remote ejB Object";
	}
	
	public String sayHello_Local() throws RemoteException {
		return "Welecome to ejb2.0, Local ejB Object";
	}
}
